﻿var eff = "#fEffect/CharacterEff/1051296/1/0#";
/*
*	冰火家族萬能NPC
*
*
*
*
*
*/
var x = "#fEffect/CharacterEff/1112949/0/0#";//高音譜記號
var kk = "#fEffect/BasicEff/MainNotice/Boss/Default/0#";//BOSS
var c = "#fEffect/CharacterEff/1032063/0/0#";//"#fUI/UIMiniGame/starPlanetRPS/heart#";//愛心
var cmark = "#fUI/UIPVP/ChampionMark/1#";//愛心
var lb = "#fEffect/ItemEff/1112811/0/0#";//藍色小光
var b = "#fEffect/CharacterEff/Shaman/1#";//超萌熊熊
var cat = "#fEffect/CharacterEff/Shaman/4#";//超萌喵咪
var leaf = "#fUI/Basic.img/Cursor/18/0#";
var tt = "#fUI/Gateway.img/WorldSelect/icon/1#";
var status;
var ll;
var achi_count = 0;

function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {

    if (mode == 0) {
	cm.dispose();
	return;
    } else if (mode == 1){
	status++;
    } else {
	status--;
    }

    switch (status) {
        case 0: 
			text = "\t\t\t     #fn华文行楷##fs30##k #d成就系統\r\n\r\n#n#fs17#";
			text += "\t\t   #e#b完成\t\t#r未完成\r\n\r\n#n#fs12##fn宋体#";
			for(var i = 0; i < 120;i++){
				ll = cm.getPlayer().getAchievement(i);
				if(ll != null){
					if(cm.getPlayer().achievementFinished(i))
						achi_count++;
				}
			}
			text += tt +"#d目前完成 : #r" + achi_count + " #d個成就!\r\n";
			for(var i = 0; i < 120;i++){
				ll = cm.getPlayer().getAchievement(i);
				if(ll != null){
					if(cm.getPlayer().achievementFinished(i)){
						text+= "#b";
					}else{
						text+="#r";
					}
					text+=tt + ll.getName()+"#l\r\n";
				}
			}
			text += "\r\n\r\n\t\t   #L999#" + leaf +"#fn华文行楷##fs22##e#r回上一頁#l"
			cm.sendOk(text);
            break;
		case 1:
			if(selection == 999){
				cm.dispose();
				cm.openNpc(1052253)
			}
			break;
        default:
			cm.sendOk("發生錯誤，請聯繫管理員!");
			cm.dispose();
			break;
    }
}
/*

var ttt = "#fUI/UIWindow/Quest/icon2/7#";//"+ttt+"//美化1

var status = -1;

function start() {
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == 0) {
        cm.dispose();
        return;
    } else {
        status++;
    }
    if (status == 0) {
        var map = Java.type("client.MapleClient");
        var text = "#d当前账户信息如下：\r\n";
        text += "====================================\r\n#b"
        text += "#L0#" + eff + "\t游戏账号： #r" + format(" ", 15, cm.getClient().getAccountName()) + "#b #e#r【改密】#b#n#l\r\n";
        text += "#L1#" + eff + "\t贊助點余额： #r" + format(" ", 15, cm.getRMB().toString()) + "#b #e#r【充值】#n#l\r\n";
        text += "#L2#" + eff + "\t#b累计充值： #r" + format(" ", 15, cm.getTotalRMB().toString()) + "#b #e#r【礼包】#b#n#l\r\n";
        text += "#L3#" + eff + "\t剩余点券： #r" + format(" ", 15, cm.getPlayer().getCSPoints(1).toString()) + "#b #e#r【兑换】#b#n#l\r\n";
        text += "#L4#" + eff + "\t剩余抵用： #r" + format(" ", 15, cm.getPlayer().getCSPoints(2).toString()) + "#b #e#r【兑换】#b#n#l\r\n\r\n";
        text += "\t\t\t\t#L5#"+ "#b" + ttt + "返回上一页";
        cm.sendSimple(text);
    } else if (status == 1) {
        if (selection == 0) {
            cm.sendOk("暂时不支持在线改密，請前往登陆器改密。");
            cm.dispose();
        } else if (selection == 1) {
            cm.openWeb("http://www.caihongms.com");
            cm.dispose();
        } else if (selection == 2) { // 礼包
            cm.dispose();
            cm.openNpc(1530638, 2);
        } else if (selection == 3) {
            selection = 0;
            cm.dispose();
            cm.openNpc(9300011, 2);
        } else if (selection == 4) {
            cm.sendOk("暂时不支持抵用券换点券。");
            cm.dispose();
		 } else if (selection == 5) {
			cm.dispose();
            cm.openNpc(1530635, 0);
        }
    }
}
*/

var format = function FormatString(c, length, content) {
    var str = "";
    var cs = "";
    if (content.length > length) {
        str = content;
    } else {
        for (var j = 0; j < length - content.getBytes("GB2312").length; j++) {
            cs = cs + c;
        }
    }
    str = content + cs;
    return str;
}
    